
import 'package:get/get.dart';
import 'counter_model.dart';

abstract class CounterIntent {
  void increment();
  void decrement();
}

class CounterController extends GetxController implements CounterIntent {
  final _state = CounterState().obs;

  CounterState get state => _state.value;

  @override
  void increment() {
    _state.update((val) {
      _state.value = state.copyWith(count: state.count + 1);
    });
  }

  @override
  void decrement() {
    _state.update((val) {
      _state.value = state.copyWith(count: state.count - 1);
    });
  }
}
